
// ---------------------------------------------------
// | File Name   : lcd1602.h
// | Author   	 : chagn7z
// | Create Date : 2014-6-16
// ---------------------------------------------------

#ifndef _LCD1602_H_
#define _LCD1602_H_

/* control signal of lcd */
#define LCD_LIGHT PCout(4)
#define LCD_OE    PCout(5)
#define LCD_RW    PBout(0)
#define LCD_RS    PBout(1)

#define LCD_D0    PAout(0)
#define LCD_D1    PAout(1)
#define LCD_D2    PAout(2)
#define LCD_D3    PAout(3)
#define LCD_D4    PAout(4)
#define LCD_D5    PAout(5)
#define LCD_D6    PAout(6)
#define LCD_D7    PAout(7)

/* lcd setup time */
#define LCD_NS    5

/* export function */
void lcd_init(void);
void lcd_clear(void);
void lcd_setline(u8 status);

/* inner function */
void lcd_writedata(u8 dat);
void lcd_writecmd(u8 cmd);
void lcd_setcursor(u8 line, u8 pos, u8 status);
void lcd_putchar(u8 line, u8 pos, u8 chr);
void lcd_putstr(u8 line, u8 pos, u8 num, u8* str);

#endif
